# -*- coding: utf-8 -*-
# @Time : 2021/05/18
# @Author : ricky
# @File : ruoyicloudconstant.py
# @Software: vscode
"""
若依微服务版本（RuoYi-Cloud）常量
"""
import sys


class _const:
    # 自定义异常处理
    class ConstError(PermissionError):
        pass

    class ConstCaseError(ConstError):
        pass

    # 重写 __setattr__() 方法
    def __setattr__(self, name, value):
        if name in self.__dict__:
            # 已包含该常量，不能二次赋值
            raise self.ConstError("Can't change const {0}".format(name))
        if not name.isupper():
            # 所有的字母需要大写
            raise self.ConstCaseError(
                "const name {0} is not all uppercase".format(name))
        self.__dict__[name] = value


const = _const()
# 默认的工程目录名称（顶层目录）
const.RUOYI_DEFAULT_PROJECT_DIR_NAME_TUPLE = ('RuoYi-Cloud',
                                              'RuoYi-Cloud-master',
                                              'RuoYi-Cloud-Oracle',
                                              'RuoYi-Cloud-Oracle-master')
# 默认的artifactId
const.RUOYI_DEFAULT_ARTIFACTID_PREFIX = 'ruoyi'
# 默认的groupId
const.RUOYI_DEFAULT_GROUP_ID = 'com.ruoyi'
# 默认的包名
const.RUOYI_DEFAULT_PACKAGE_NAME = 'com.ruoyi'
# 默认的站点名称
const.RUOYI_DEFAULT_SITE_NAME = '若依微服务系统'
# 默认的项目名称
const.RUOYI_DEFAULT_PROJECT_NAME = 'ruoyi'
# 默认的nacos配置sql前缀
const.RUOYI_DEFAULT_NACOS_CONFIG_SQL_PREFIX = 'ry_config_'
# 需要修改站点名称的资源路径
const.RUOYI_SITE_RESOURCES_PATH_TUPLE = (
    'ruoyi-ui#.env.development', 'ruoyi-ui#.env.production',
    'ruoyi-ui#.env.staging', 'ruoyi-ui#package.json', 'ruoyi-ui#vue.config.js',
    'ruoyi-ui#src#settings.js',
    'ruoyi-ui#src#layout#components#Sidebar#Logo.vue',
    'ruoyi-ui#src#views#login.vue')
# 默认的模块名
const.RUOYI_DEFAULT_MODULE_NAME_TUPLE = (
    'ruoyi-api#ruoyi-api-system',
    'ruoyi-common#ruoyi-common-core',
    'ruoyi-common#ruoyi-common-datascope',
    'ruoyi-common#ruoyi-common-datasource',
    'ruoyi-common#ruoyi-common-log',
    'ruoyi-common#ruoyi-common-redis',
    'ruoyi-common#ruoyi-common-security',
    'ruoyi-common#ruoyi-common-swagger',
    'ruoyi-modules#ruoyi-file',
    'ruoyi-modules#ruoyi-gen',
    'ruoyi-modules#ruoyi-job',
    'ruoyi-modules#ruoyi-system',
    'ruoyi-visual#ruoyi-monitor',
    'ruoyi-api',
    'ruoyi-auth',
    'ruoyi-common',
    'ruoyi-gateway',
    'ruoyi-modules',
    'ruoyi-visual',
    'ruoyi-ui',
)
# 将系统加载的模块列表中的 constant 替换为 _const() 实例
sys.modules[__name__] = const